\(\int (e \sec (c+d x))^{2-2 n} (a+i a \tan (c+d x))^n \, dx\) [495]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [F]
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [F]
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 30, antiderivative size = 46 \[ \int (e \sec (c+d x))^{2-2 n} (a+i a \tan (c+d x))^n \, dx=\frac {i a (e \sec (c+d x))^{2-2 n} (a+i a \tan (c+d x))^{-1+n}}{d (1-n)} \]

[Out]

I*a*(e*sec(d*x+c))^(2-2*n)*(a+I*a*tan(d*x+c))^(-1+n)/d/(1-n)

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 46, normalized size of antiderivative = 1.00, number of steps used = 1, number of rules used = 1, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.033, Rules used = {3574} \[ \int (e \sec (c+d x))^{2-2 n} (a+i a \tan (c+d x))^n \, dx=\frac {i a (a+i a \tan (c+d x))^{n-1} (e \sec (c+d x))^{2-2 n}}{d (1-n)} \]

[In]

Int[(e*Sec[c + d*x])^(2 - 2*n)*(a + I*a*Tan[c + d*x])^n,x]

[Out]

(I*a*(e*Sec[c + d*x])^(2 - 2*n)*(a + I*a*Tan[c + d*x])^(-1 + n))/(d*(1 - n))

Rule 3574

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[2*b*(
d*Sec[e + f*x])^m*((a + b*Tan[e + f*x])^(n - 1)/(f*m)), x] /; FreeQ[{a, b, d, e, f, m, n}, x] && EqQ[a^2 + b^2
, 0] && EqQ[Simplify[m/2 + n - 1], 0]

Rubi steps \begin{align*} \text {integral}& = \frac {i a (e \sec (c+d x))^{2-2 n} (a+i a \tan (c+d x))^{-1+n}}{d (1-n)} \\ \end{align*}

Mathematica [A] (verified)

Time = 1.97 (sec) , antiderivative size = 59, normalized size of antiderivative = 1.28 \[ \int (e \sec (c+d x))^{2-2 n} (a+i a \tan (c+d x))^n \, dx=-\frac {e^2 (e \sec (c+d x))^{-2 n} (i+\sec (c) \sec (c+d x) \sin (d x)+\tan (c)) (a+i a \tan (c+d x))^n}{d (-1+n)} \]

[In]

Integrate[(e*Sec[c + d*x])^(2 - 2*n)*(a + I*a*Tan[c + d*x])^n,x]

[Out]

-((e^2*(I + Sec[c]*Sec[c + d*x]*Sin[d*x] + Tan[c])*(a + I*a*Tan[c + d*x])^n)/(d*(-1 + n)*(e*Sec[c + d*x])^(2*n
)))

Maple [F]

\[\int \left (e \sec \left (d x +c \right )\right )^{2-2 n} \left (a +i a \tan \left (d x +c \right )\right )^{n}d x\]

[In]

int((e*sec(d*x+c))^(2-2*n)*(a+I*a*tan(d*x+c))^n,x)

[Out]

int((e*sec(d*x+c))^(2-2*n)*(a+I*a*tan(d*x+c))^n,x)

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 109 vs. \(2 (40) = 80\).

Time = 0.25 (sec) , antiderivative size = 109, normalized size of antiderivative = 2.37 \[ \int (e \sec (c+d x))^{2-2 n} (a+i a \tan (c+d x))^n \, dx=\frac {\left (\frac {2 \, e e^{\left (i \, d x + i \, c\right )}}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}\right )^{-2 \, n + 2} {\left (-i \, e^{\left (2 i \, d x + 2 i \, c\right )} - i\right )} e^{\left (i \, d n x + i \, c n - 2 i \, d x + n \log \left (\frac {2 \, e e^{\left (i \, d x + i \, c\right )}}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}\right ) + n \log \left (\frac {a}{e}\right ) - 2 i \, c\right )}}{2 \, {\left (d n - d\right )}} \]

[In]

integrate((e*sec(d*x+c))^(2-2*n)*(a+I*a*tan(d*x+c))^n,x, algorithm="fricas")

[Out]

1/2*(2*e*e^(I*d*x + I*c)/(e^(2*I*d*x + 2*I*c) + 1))^(-2*n + 2)*(-I*e^(2*I*d*x + 2*I*c) - I)*e^(I*d*n*x + I*c*n
 - 2*I*d*x + n*log(2*e*e^(I*d*x + I*c)/(e^(2*I*d*x + 2*I*c) + 1)) + n*log(a/e) - 2*I*c)/(d*n - d)

Sympy [F]

\[ \int (e \sec (c+d x))^{2-2 n} (a+i a \tan (c+d x))^n \, dx=\int \left (e \sec {\left (c + d x \right )}\right )^{2 - 2 n} \left (i a \left (\tan {\left (c + d x \right )} - i\right )\right )^{n}\, dx \]

[In]

integrate((e*sec(d*x+c))**(2-2*n)*(a+I*a*tan(d*x+c))**n,x)

[Out]

Integral((e*sec(c + d*x))**(2 - 2*n)*(I*a*(tan(c + d*x) - I))**n, x)

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 217 vs. \(2 (40) = 80\).

Time = 0.36 (sec) , antiderivative size = 217, normalized size of antiderivative = 4.72 \[ \int (e \sec (c+d x))^{2-2 n} (a+i a \tan (c+d x))^n \, dx=\frac {{\left (-i \, a^{n} e^{2} - \frac {2 \, a^{n} e^{2} \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {i \, a^{n} e^{2} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}\right )} e^{\left (n \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right ) + n \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right ) + n \log \left (-\frac {2 i \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {\sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} - 1\right ) - 2 \, n \log \left (-\frac {\sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} - 1\right )\right )}}{{\left (e^{2 \, n} {\left (n - 1\right )} - \frac {e^{2 \, n} {\left (n - 1\right )} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}\right )} d} \]

[In]

integrate((e*sec(d*x+c))^(2-2*n)*(a+I*a*tan(d*x+c))^n,x, algorithm="maxima")

[Out]

(-I*a^n*e^2 - 2*a^n*e^2*sin(d*x + c)/(cos(d*x + c) + 1) + I*a^n*e^2*sin(d*x + c)^2/(cos(d*x + c) + 1)^2)*e^(n*
log(sin(d*x + c)/(cos(d*x + c) + 1) + 1) + n*log(sin(d*x + c)/(cos(d*x + c) + 1) - 1) + n*log(-2*I*sin(d*x + c
)/(cos(d*x + c) + 1) + sin(d*x + c)^2/(cos(d*x + c) + 1)^2 - 1) - 2*n*log(-sin(d*x + c)^2/(cos(d*x + c) + 1)^2
 - 1))/((e^(2*n)*(n - 1) - e^(2*n)*(n - 1)*sin(d*x + c)^2/(cos(d*x + c) + 1)^2)*d)

Giac [F]

\[ \int (e \sec (c+d x))^{2-2 n} (a+i a \tan (c+d x))^n \, dx=\int { \left (e \sec \left (d x + c\right )\right )^{-2 \, n + 2} {\left (i \, a \tan \left (d x + c\right ) + a\right )}^{n} \,d x } \]

[In]

integrate((e*sec(d*x+c))^(2-2*n)*(a+I*a*tan(d*x+c))^n,x, algorithm="giac")

[Out]

integrate((e*sec(d*x + c))^(-2*n + 2)*(I*a*tan(d*x + c) + a)^n, x)

Mupad [B] (verification not implemented)

Time = 5.63 (sec) , antiderivative size = 106, normalized size of antiderivative = 2.30 \[ \int (e \sec (c+d x))^{2-2 n} (a+i a \tan (c+d x))^n \, dx=-\frac {e^2\,\left (\cos \left (2\,c+2\,d\,x\right )\,1{}\mathrm {i}+\sin \left (2\,c+2\,d\,x\right )+1{}\mathrm {i}\right )\,{\left (\frac {a\,\left (\cos \left (2\,c+2\,d\,x\right )+1+\sin \left (2\,c+2\,d\,x\right )\,1{}\mathrm {i}\right )}{\cos \left (2\,c+2\,d\,x\right )+1}\right )}^n}{d\,\left (\cos \left (2\,c+2\,d\,x\right )+1\right )\,{\left (\frac {e}{\cos \left (c+d\,x\right )}\right )}^{2\,n}\,\left (n-1\right )} \]

[In]

int((e/cos(c + d*x))^(2 - 2*n)*(a + a*tan(c + d*x)*1i)^n,x)

[Out]

-(e^2*(cos(2*c + 2*d*x)*1i + sin(2*c + 2*d*x) + 1i)*((a*(cos(2*c + 2*d*x) + sin(2*c + 2*d*x)*1i + 1))/(cos(2*c
 + 2*d*x) + 1))^n)/(d*(cos(2*c + 2*d*x) + 1)*(e/cos(c + d*x))^(2*n)*(n - 1))